package com.thinkgem.jeesite.common.web;

import javax.servlet.ServletContextEvent;

import com.thinkgem.jeesite.common.security.iauth.IUserSession;
import com.thinkgem.jeesite.common.security.iauth.UserUtils;
import com.thinkgem.jeesite.common.utils.SpringContextHolder;

public class WebContextListener extends org.springframework.web.context.ContextLoaderListener {
	
	
	@Override
	public void contextInitialized(ServletContextEvent event) {
		super.initWebApplicationContext(event.getServletContext());
		IUserSession<?> userSession = SpringContextHolder.getBean(IUserSession.class);
		if (userSession == null) {
			System.err.println("IUserSession null ");
		} else {
			UserUtils.setUserSession(userSession);
			System.out.println("IUserSession initilized");
		}
	}
	
}
